import jdk.swing.interop.SwingInterOpUtils;

import java.sql.SQLOutput;
import java.util.Random;
import java.util.Scanner;

public class Text {
    public static void main(String[] args) {
        //猜数字游戏
        Random random = new Random();
        int randNum = random.nextInt(100);
        while(true){
            System.out.println("请输入你猜的数字：");
            Scanner scan = new Scanner(System.in);
            int num = scan.nextInt();
            if(num < randNum){
                System.out.println("小了");
            }else if(num == randNum){
                System.out.println("猜对了");
                break;
            }else{
                System.out.println("大了");
            }

        }
    }




    public static void main6(String[] args) {
        // 求出0~999之间所有的水仙花数
        for (int i = 0; i < 999; i++) {
            int count = 0;
            int tmp = i;
            while(tmp!=0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            int sum = 0;
            while(tmp !=0 ){
                sum += Math.pow(tmp % 10,count);
                tmp /=10;
            }
            if(sum == i){
                System.out.println(i);
            }
        }
    }



    public static void main5(String[] args) {
        //求两个数的最大公约数
        //辗转相除法
        int a = 12;
        int b = 39;
        int c = a%b;
        while(c != 0){
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }







    public static void main20(String[] args) {
        //输出乘法口诀表
        int s = 0;
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j <= i; j++) {
                s = i * j;
                System.out.print(j + "*" + i + "=" + s + " ");
            }
            System.out.println();
        }
    }


    public static void main11(String[] args) {
        //输出1000~2000之间所有的闰年
        for (int i = 1000; i <= 2000; i++) {
            if ((i % 4 == 0 && i % 100 != 0) || i % 100 == 0) {
                System.out.println(i);
            }
        }
    }


   


    public static void main2(String[] args) {
        //判断一个数是否是素数
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入一个数：");
            int num = scan.nextInt();
            int i = 2;
            int fla=1;
            for (i = 2; i <= Math.sqrt(num); i++) {
                if(num % i == 0){
                    fla = 0;
                    break;
                }
            }
            if(fla == 0){
                System.out.println(num+"不是素数！");
            }else{
                System.out.println(num+"是素数！");
            }
    }





    public static void main1(String[] args) {
        //根据年龄判断是少年，青年，中年，老年
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入年龄：");
        int age = scan.nextInt();
        if(age <= 18){
            System.out.println("少年");
        }else if(age >= 19 && age <= 28){
            System.out.println("青年");
        }else if(age >= 29 && age <= 55){
            System.out.println("中年");
        }else{
            System.out.println("老年");
        }
    }
}
